//当前模块的小仓库
import {reqCategoryList,reqGetBannrtList,reqGetFloorList} from '../../api'
const state={
    categoryList:[], //三级菜单数据
    bannerList:[],   //轮播数据
    floorList:[]
}
const mutations={
    CATEGORYLIST(state,categoryList){
        state.categoryList=categoryList
    },
    GETBANNERLIST(state,GetBannerList){
         state.bannerList=GetBannerList
    },
    GETFLOORLIST(state,GetFloorList){
        state.floorList=GetFloorList
    }
}
const actions={
    async categoryList({commit}){
        let result= await reqCategoryList()
        /* console.log("home仓库",result) */
        if(result.code==200){
            commit('CATEGORYLIST',result.data)
        }

    },
    //获取首页轮播图的数据
    async GetBannerList({commit}){
       let result=await reqGetBannrtList()
       if(result.code==200){
        commit('GETBANNERLIST',result.data)
    }
    },
    //获取floor轮播图的数据
    async GetFloorList({commit}){
        let result=await reqGetFloorList()
        if(result.code==200){
            commit('GETFLOORLIST',result.data)
        }
    }
}
const getters={}
export default{
    state,
    mutations,
    actions,
    getters
}